package cn.tedu.csmall.cart.mapper;

import cn.tedu.csmall.commons.pojo.cart.model.Cart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface CartMapper {
    @Insert("insert into cart_tbl(commodity_code,price,count,user_id) values" +
            "(#{commodityCode},#{price},#{count},#{userId}) ")
    int insertCart(Cart cart);
    @Delete("delete from cart_tbl where user_id=#{userId} and " +
            "commodity_code=#{commodityCode}")
    int deleteCartByUserIdAndCommodityCody(@Param("userId") String userId
            ,@Param("commodityCode") String commodityCode );
}
